package day;

import java.util.StringJoiner;

/**
 * Copyright © 2021 Devin. All rights reserved.
 * Created by Devin on 2021/6/7
 */
public class Hello {

    public static void main(String[] args) {

//       Object sj = new StringJoiner("m", "hello","");
//       System.out.println(sj);
//
//       Thread t = new Thread(() -> {
//           System.out.println("start new thread!");
//       });
//       t.start();
        System.out.println("main start...");
        Thread t = new Thread() {
            public void run() {
                System.out.println("thread run...");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {}
                System.out.println("thread end.");
            }
        };
        t.start();

        System.out.println("main end...");
    }

    public void hello() {}

    // 方法名相同，参数不同称为方法重载
    // 方法重载的返回值类型通常都是相同的
    public void hello(String s) {}
}

class Person {
    // private 修饰的属性子类不能访问
    // protected 可以
    protected String name;
    protected int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void say() {}
}

// java 单继承
class Student extends Person {

    protected int score;
    public Student(String name, int age, int score) {
        super(name, age);
        this.score = score;
    }

    void hello() {
        this.name = "";
    }

    @Override
    public void say() {
        super.say();
    }
}